package com.atguigu.redis.single;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class Fenion {
    public static  BlockingQueue<Integer>blockingQueue = new ArrayBlockingQueue<>(100);
    public static void main(String[] args) {
        Map<Integer, Integer>map=new ConcurrentHashMap<>();
        for (int i = 0; i < 100; i++) {
            blockingQueue.offer(i);
        }
        for (int i = 0; i < 10; i++) {
            map.put(i,0);
        }
        for (int i = 0; i < 1000; i++) {
            int finalI = i;
            new Thread(()->{
               int number =  finalI %10;
               int count = map.get(number)+1;
                map.put(number,count);
            },String.valueOf(i)).start();
        }
        System.out.println(map.toString());



    }
}
